package com.example.as_sum.view;

import android.content.Context;
import android.os.Build;
import android.util.AttributeSet;
import android.widget.EditText;

/**
 * Created by ran on 2016/5/24.
 */
public class MyEditText extends EditText {

    private static final int ID_PASTE = android.R.id.paste;
    private static final int ID_COPY = android.R.id.copy;
    private static final int ID_SELECT_ALL = android.R.id.selectAll;
    private static final int ID_CUT = android.R.id.cut;

    public MyEditText(Context context) {
        super(context);
    }

    public MyEditText(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyEditText(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        if (Build.VERSION.SDK_INT < 11) {
            setLongClickable(false);
        }
    }
    @Override
    public boolean onTextContextMenuItem(int id) {

        if(id==ID_COPY){
            return false;
        } else if (id == ID_PASTE) {
            return false;
        } else if(id==ID_CUT){
            return false;
        } else if (id == ID_SELECT_ALL) {
            return false;
        }
        return super.onTextContextMenuItem(id);
    }
}
